import request from '@/utils/request'

export const baseUrl = '/system/user'
export const baseApiName = '用户'

export function findAll(params) {
	return request({
		url: `${baseUrl}`,
		method: 'get',
		params,
		apiName: `${baseApiName}列表`
	})
}

export function findAllNoPage(params) {
	return request({
		url: `${baseUrl}/findAllNoPage`,
		method: 'get',
		params,
		apiName: `${baseApiName}列表`
	})
}

export function findChildAllPage(params) {
	return request({
		url: `${baseUrl}/findChildAllPage`,
		method: 'get',
		params,
		apiName: `${baseApiName}列表`
	})
}

export function findOne(id) {
	return request({
		url: `${baseUrl}/${id}`,
		method: 'get',
		apiName: `${baseApiName}更具id查询`
	})
}

export function create(data) {
	return request({
		url: `${baseUrl}`,
		method: 'post',
		data,
		apiName: `${baseApiName}创建`
	})
}


export function update(id, data) {
	return request({
		url: `${baseUrl}/${id}`,
		method: 'patch',
		data,
		apiName: `${baseApiName}修改`
	})
}

export function remove(id) {
	return request({
		url: `${baseUrl}/${id}`,
		method: 'delete',
		apiName: `${baseApiName}删除`
	})
}

export function getUserMenu(params) {
	return request({
		url: `${baseUrl}/getUserMenu`,
		method: 'get',
		params,
		apiName: `${baseApiName}`
	})
}

export function login(data) {
	return request({
		url: '/system/user/login',
		method: 'post',
		data,
		apiName: `${baseApiName}登录`
	})
}

export function getInfo() {
	return request({
		url: '/system/user/info',
		method: 'get',
		apiName: `${baseApiName}信息`
	})
}

export function logout() {
	return request({
		url: '/vue-admin-template/user/logout',
		method: 'post'
	})
}

